﻿<UserControl x:Class="StockAnalyst2.Plugins.Visualization.Historical.SummaryViewer"
    		 x:ClassModifier="internal"
			 
			 xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             mc:Ignorable="d" 
			 
			 xmlns:Converters="clr-namespace:Utils.Wpf.Converters;assembly=Utils"
             xmlns:sys="clr-namespace:System;assembly=mscorlib"
             xmlns:Historical="clr-namespace:StockAnalyst2.Plugins.Visualization.Historical" 
			 
			 Background="#1F1F1F" 
			 
			 d:DataContext="{d:DesignInstance Type=Historical:SummaryViewerVM}" 
			 d:DesignWidth="1200"
			 d:DesignHeight="150" >

	<UserControl.Resources>
		<ResourceDictionary>
			<Converters:MultiValueToColorConverter x:Key="MultiValueToColorConverter" />
			<ResourceDictionary.MergedDictionaries>
				<ResourceDictionary Source="..\..\..\StockAnalystTheme.xaml" />
			</ResourceDictionary.MergedDictionaries>
		</ResourceDictionary>
	</UserControl.Resources>

	<Expander IsExpanded="True" >
		<Expander.HeaderTemplate>
			<DataTemplate>
				<TextBlock Foreground="{StaticResource FontBrush}" Text="Summary" FontWeight="Bold" Margin="9,3,3,3" />
			</DataTemplate>
		</Expander.HeaderTemplate>
		<Grid>
			<Grid.ColumnDefinitions>
				<ColumnDefinition Width="Auto" />
				<ColumnDefinition Width="Auto" />
				<ColumnDefinition Width="Auto" />
				<ColumnDefinition Width="Auto" />
				<ColumnDefinition Width="Auto" />
				<ColumnDefinition Width="Auto" />
				<ColumnDefinition Width="Auto" />
				<ColumnDefinition Width="Auto" />
				<ColumnDefinition Width="Auto" />
				<ColumnDefinition Width="Auto" />
				<ColumnDefinition Width="Auto" />
				<ColumnDefinition Width="Auto" />
				<ColumnDefinition Width="Auto" />
				<ColumnDefinition Width="Auto" />
				<ColumnDefinition Width="Auto" />
				<ColumnDefinition Width="Auto" />
				<ColumnDefinition Width="Auto" />
				<ColumnDefinition Width="Auto" />
				<ColumnDefinition Width="Auto" />
				<ColumnDefinition Width="Auto" />
				<ColumnDefinition Width="*" />
			</Grid.ColumnDefinitions>
			<Grid.RowDefinitions>
				<RowDefinition Height="Auto" />
				<RowDefinition Height="Auto" />
				<RowDefinition Height="Auto" />
				<RowDefinition Height="Auto" />
				<RowDefinition Height="Auto" />
				<RowDefinition Height="Auto" />
			</Grid.RowDefinitions>

			<!-- Key Values -->
			<TextBlock Grid.Row="0" Grid.Column="0" Margin="3" Text="Total Result: " FontWeight="DemiBold" />
			<TextBlock Grid.Row="0" Grid.Column="1" Margin="3" Text="{Binding TotalResult, FallbackValue=000}" HorizontalAlignment="Right" FontWeight="DemiBold" >
						<TextBlock.Resources>
							<sys:Boolean x:Key="enabled">True</sys:Boolean>
							<sys:Decimal x:Key="maxValue">100</sys:Decimal>
						</TextBlock.Resources>
						<TextBlock.Foreground>
							<MultiBinding Converter="{StaticResource MultiValueToColorConverter}">
								<Binding Path="TotalResult" />
								<Binding Source="{StaticResource maxValue}" />
								<Binding Source="{StaticResource enabled}" />
							</MultiBinding>
						</TextBlock.Foreground>
			</TextBlock>
			<TextBlock Grid.Row="0" Grid.Column="2" Margin="3" Text="€" FontWeight="DemiBold" />

			<TextBlock Grid.Row="0" Grid.Column="3" Margin="50,3,3,3" Text="Average Operation: " FontWeight="DemiBold" />
			<TextBlock Grid.Row="0" Grid.Column="4" Margin="3" Text="{Binding AverageOperation, FallbackValue=000}" HorizontalAlignment="Right" FontWeight="DemiBold" >
						<TextBlock.Resources>
							<sys:Boolean x:Key="enabled">True</sys:Boolean>
							<sys:Decimal x:Key="maxValue">10</sys:Decimal>
						</TextBlock.Resources>
						<TextBlock.Foreground>
							<MultiBinding Converter="{StaticResource MultiValueToColorConverter}">
								<Binding Path="AverageOperation" />
								<Binding Source="{StaticResource maxValue}" />
								<Binding Source="{StaticResource enabled}" />
							</MultiBinding>
						</TextBlock.Foreground>
			</TextBlock>
			<TextBlock Grid.Row="0" Grid.Column="5" Margin="3" Text="€" FontWeight="DemiBold" />
			<TextBlock Grid.Row="0" Grid.Column="6" Margin="50,3,3,3" Text="Max Amount Required: " FontWeight="DemiBold" />
			<TextBlock Grid.Row="0" Grid.Column="7" Margin="3" Text="{Binding MaxAmountRequired, FallbackValue=000}" HorizontalAlignment="Right" FontWeight="DemiBold" />
			<TextBlock Grid.Row="0" Grid.Column="8" Margin="3" Text="€" FontWeight="DemiBold" />
			<TextBlock Grid.Row="0" Grid.Column="9" Margin="50,3,3,3" Text="Profit: " FontWeight="DemiBold" />
			<TextBlock Grid.Row="0" Grid.Column="10" Margin="3" Text="{Binding Profit, FallbackValue=000}" HorizontalAlignment="Right" FontWeight="DemiBold" >
					<TextBlock.Resources>
						<sys:Boolean x:Key="enabled">True</sys:Boolean>
						<sys:Decimal x:Key="maxValue">10</sys:Decimal>
					</TextBlock.Resources>
					<TextBlock.Foreground>
						<MultiBinding Converter="{StaticResource MultiValueToColorConverter}">
							<Binding Path="AverageOperation" />
							<Binding Source="{StaticResource maxValue}" />
							<Binding Source="{StaticResource enabled}" />
						</MultiBinding>
					</TextBlock.Foreground>
			</TextBlock>
			<TextBlock Grid.Row="0" Grid.Column="11" Margin="3" Text="%" FontWeight="DemiBold" />
			<TextBlock Grid.Row="0" Grid.Column="12" Margin="50,3,3,3" Text="Daily Profit: " FontWeight="Bold" />
			<TextBlock Grid.Row="0" Grid.Column="13" Margin="3" Text="{Binding DailyProfit, FallbackValue=00000}" HorizontalAlignment="Right" FontWeight="Bold" >
					<TextBlock.Resources>
						<sys:Boolean x:Key="enabled">True</sys:Boolean>
						<sys:Decimal x:Key="maxValue">10</sys:Decimal>
					</TextBlock.Resources>
					<TextBlock.Foreground>
						<MultiBinding Converter="{StaticResource MultiValueToColorConverter}">
							<Binding Path="AverageOperation" />
							<Binding Source="{StaticResource maxValue}" />
							<Binding Source="{StaticResource enabled}" />
						</MultiBinding>
					</TextBlock.Foreground>
			</TextBlock>
			<TextBlock Grid.Row="0" Grid.Column="14" Margin="3" Text="%" FontWeight="Bold" />

			<!-- Separator -->
			<Border Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="22" BorderBrush="{StaticResource SelectedRowBrush}" BorderThickness="1" Margin="0,10,0,10" />

			<!-- Other Values -->
			<TextBlock Grid.Row="2" Grid.Column="0" Margin="3" Text="Total Win: " />
			<TextBlock Grid.Row="2" Grid.Column="1" Margin="3" Text="{Binding TotalWin, FallbackValue=000}" HorizontalAlignment="Right" Foreground="{StaticResource GreenSmooth}" />
			<TextBlock Grid.Row="2" Grid.Column="2" Margin="3" Text="€" />
			<TextBlock Grid.Row="3" Grid.Column="0" Margin="3" Text="Average Win: " />
			<TextBlock Grid.Row="3" Grid.Column="1" Margin="3" Text="{Binding AverageWin, FallbackValue=000}" HorizontalAlignment="Right" Foreground="{StaticResource GreenSmooth}" />
			<TextBlock Grid.Row="3" Grid.Column="2" Margin="3" Text="€" />
			<TextBlock Grid.Row="4" Grid.Column="0" Margin="3" Text="Max Win Operation: " />
			<TextBlock Grid.Row="4" Grid.Column="1" Margin="3" Text="{Binding MaxWinOperation, FallbackValue=000}" HorizontalAlignment="Right" Foreground="{StaticResource GreenSmooth}" />
			<TextBlock Grid.Row="4" Grid.Column="2" Margin="3" Text="€" />

			<TextBlock Grid.Row="2" Grid.Column="3" Margin="50,3,3,3" Text="Total Loss: " />
			<TextBlock Grid.Row="2" Grid.Column="4" Margin="3" Text="{Binding TotalLoss, FallbackValue=000}" HorizontalAlignment="Right" Foreground="{StaticResource RedSmooth}" />
			<TextBlock Grid.Row="2" Grid.Column="5" Margin="3" Text="€" />
			<TextBlock Grid.Row="3" Grid.Column="3" Margin="50,3,3,3" Text="Average Loss: " />
			<TextBlock Grid.Row="3" Grid.Column="4" Margin="3" Text="{Binding AverageLoss, FallbackValue=000}" HorizontalAlignment="Right" Foreground="{StaticResource RedSmooth}" />
			<TextBlock Grid.Row="3" Grid.Column="5" Margin="3" Text="€" />
			<TextBlock Grid.Row="4" Grid.Column="3" Margin="50,3,3,3" Text="Max Loss Operation: " />
			<TextBlock Grid.Row="4" Grid.Column="4" Margin="3" Text="{Binding MaxLossOperation, FallbackValue=000}" HorizontalAlignment="Right" Foreground="{StaticResource RedSmooth}" />
			<TextBlock Grid.Row="4" Grid.Column="5" Margin="3" Text="€" />

			<TextBlock Grid.Row="2" Grid.Column="6" Margin="50,3,3,3" Text="Win Operations: " />
			<TextBlock Grid.Row="2" Grid.Column="7" Margin="3" Text="{Binding WinOperations, FallbackValue=000}" HorizontalAlignment="Right" />
			<TextBlock Grid.Row="3" Grid.Column="6" Margin="50,3,3,3" Text="Loss Operations: " />
			<TextBlock Grid.Row="3" Grid.Column="7" Margin="3" Text="{Binding LossOperations, FallbackValue=000}" HorizontalAlignment="Right" />
			<TextBlock Grid.Row="4" Grid.Column="6" Margin="50,3,3,3" Text="Win Operations (%): " />
			<TextBlock Grid.Row="4" Grid.Column="7" Margin="3" Text="{Binding WinOperationsPercentage, FallbackValue=000}" HorizontalAlignment="Right" />
			<TextBlock Grid.Row="4" Grid.Column="8" Margin="3" Text="%" />
			<TextBlock Grid.Row="5" Grid.Column="6" Margin="50,3,3,3" Text="Loss Operations (%): " />
			<TextBlock Grid.Row="5" Grid.Column="7" Margin="3" Text="{Binding LossOperationsPercentage, FallbackValue=000}" HorizontalAlignment="Right" />
			<TextBlock Grid.Row="5" Grid.Column="8" Margin="3" Text="%" />

			<TextBlock Grid.Row="2" Grid.Column="9" Margin="50,3,3,3" Text="Best Partial: " />
			<TextBlock Grid.Row="2" Grid.Column="10" Margin="3" Text="{Binding MaxWin, FallbackValue=000}" HorizontalAlignment="Right" >
					<TextBlock.Resources>
						<sys:Boolean x:Key="enabled">True</sys:Boolean>
						<sys:Decimal x:Key="maxValue">10</sys:Decimal>
					</TextBlock.Resources>
					<TextBlock.Foreground>
						<MultiBinding Converter="{StaticResource MultiValueToColorConverter}">
							<Binding Path="MaxWin" />
							<Binding Source="{StaticResource maxValue}" />
							<Binding Source="{StaticResource enabled}" />
						</MultiBinding>
					</TextBlock.Foreground>
			</TextBlock>
			<TextBlock Grid.Row="2" Grid.Column="11" Margin="3" Text="€" />
			<TextBlock Grid.Row="3" Grid.Column="9" Margin="50,3,3,3" Text="Worst Partial: " />
			<TextBlock Grid.Row="3" Grid.Column="10" Margin="3" Text="{Binding MaxLoss, FallbackValue=000}" HorizontalAlignment="Right" >
					<TextBlock.Resources>
						<sys:Boolean x:Key="enabled">True</sys:Boolean>
						<sys:Decimal x:Key="maxValue">10</sys:Decimal>
					</TextBlock.Resources>
					<TextBlock.Foreground>
						<MultiBinding Converter="{StaticResource MultiValueToColorConverter}">
							<Binding Path="MaxLoss" />
							<Binding Source="{StaticResource maxValue}" />
							<Binding Source="{StaticResource enabled}" />
						</MultiBinding>
					</TextBlock.Foreground>
			</TextBlock>
			<TextBlock Grid.Row="3" Grid.Column="11" Margin="3" Text="€" />

			<TextBlock Grid.Row="2" Grid.Column="12" Margin="50,3,3,3" Text="Total Operations: " />
			<TextBlock Grid.Row="2" Grid.Column="13" Margin="3" Text="{Binding TotalOperations, FallbackValue=000}" HorizontalAlignment="Right" />
			<TextBlock Grid.Row="3" Grid.Column="12" Margin="50,3,3,3" Text="Total Days: " />
			<TextBlock Grid.Row="3" Grid.Column="13" Margin="3" Text="{Binding TotalDays, FallbackValue=000}" HorizontalAlignment="Right"  />

			<GroupBox Grid.Row="2" Grid.Column="15" Grid.RowSpan="4" Header="Strikes" Margin="20,0,0,0" >
				<Grid>
					<Grid.RowDefinitions>
						<RowDefinition Height="Auto" />
						<RowDefinition Height="Auto" />
						<RowDefinition Height="Auto" />
					</Grid.RowDefinitions>
					<Grid.ColumnDefinitions>
						<ColumnDefinition Width="Auto" />
						<ColumnDefinition Width="Auto" />
						<ColumnDefinition Width="Auto" />
						<ColumnDefinition Width="Auto" />
						<ColumnDefinition Width="Auto" />
						<ColumnDefinition Width="*" />
					</Grid.ColumnDefinitions>

					<TextBlock Grid.Row="0" Grid.Column="1" Margin="3" Text="Strike" />
					<TextBlock Grid.Row="0" Grid.Column="3" Margin="3" Text="%" />
					<TextBlock Grid.Row="1" Grid.Column="4" Margin="3" Text="%" />
					<TextBlock Grid.Row="2" Grid.Column="4" Margin="3" Text="%" />
					<TextBlock Grid.Row="0" Grid.Column="5" Margin="3" Text="Date Range" HorizontalAlignment="Center" />

					<TextBlock Grid.Row="1" Grid.Column="0" Margin="3" Text="Best" />
					<TextBlock Grid.Row="2" Grid.Column="0" Margin="3" Text="Worst" />

					<TextBlock Grid.Row="1" Grid.Column="1" Margin="3" Text="{Binding BestResult, FallbackValue=000}" HorizontalAlignment="Right" >
							<TextBlock.Resources>
								<sys:Boolean x:Key="enabled">True</sys:Boolean>
								<sys:Decimal x:Key="maxValue">100</sys:Decimal>
							</TextBlock.Resources>
							<TextBlock.Foreground>
								<MultiBinding Converter="{StaticResource MultiValueToColorConverter}">
									<Binding Path="BestResult" />
									<Binding Source="{StaticResource maxValue}" />
									<Binding Source="{StaticResource enabled}" />
								</MultiBinding>
							</TextBlock.Foreground>
					</TextBlock>
					<TextBlock Grid.Row="1" Grid.Column="2" Margin="3" Text="€" />
					<TextBlock Grid.Row="2" Grid.Column="1" Margin="3" Text="{Binding WorstResult, FallbackValue=000}" HorizontalAlignment="Right" >
							<TextBlock.Resources>
								<sys:Boolean x:Key="enabled">True</sys:Boolean>
								<sys:Decimal x:Key="maxValue">100</sys:Decimal>
							</TextBlock.Resources>
							<TextBlock.Foreground>
								<MultiBinding Converter="{StaticResource MultiValueToColorConverter}">
									<Binding Path="WorstResult" />
									<Binding Source="{StaticResource maxValue}" />
									<Binding Source="{StaticResource enabled}" />
								</MultiBinding>
							</TextBlock.Foreground>
					</TextBlock>
					<TextBlock Grid.Row="2" Grid.Column="2" Margin="3" Text="€" />

					<TextBlock Grid.Row="1" Grid.Column="3" Margin="3" Text="{Binding BestResultPercentage, StringFormat=#00}" HorizontalAlignment="Right" >
						<TextBlock.Resources>
							<sys:Boolean x:Key="enabled">True</sys:Boolean>
							<sys:Decimal x:Key="maxValue">50</sys:Decimal>
						</TextBlock.Resources>
						<TextBlock.Foreground>
							<MultiBinding Converter="{StaticResource MultiValueToColorConverter}">
								<Binding Path="BestResultPercentage" />
								<Binding Source="{StaticResource maxValue}" />
								<Binding Source="{StaticResource enabled}" />
							</MultiBinding>
						</TextBlock.Foreground>
					</TextBlock>

					<TextBlock Grid.Row="2" Grid.Column="3" Margin="3" Text="{Binding WorstResultPercentage, StringFormat=#00}" HorizontalAlignment="Right" >
					<TextBlock.Resources>
						<sys:Boolean x:Key="enabled">True</sys:Boolean>
						<sys:Decimal x:Key="minValue">50</sys:Decimal>
					</TextBlock.Resources>
					<TextBlock.Foreground>
						<MultiBinding Converter="{StaticResource MultiValueToColorConverter}">
							<Binding Path="WorstResultPercentage" />
							<Binding Source="{StaticResource minValue}" />
							<Binding Source="{StaticResource enabled}" />
						</MultiBinding>
					</TextBlock.Foreground>
				</TextBlock>
					
				<TextBlock Grid.Row="1" Grid.Column="5" Margin="10,3,3,3" Text="{Binding BestResultPeriod, FallbackValue=01/01/2000-31/12/2001}" HorizontalAlignment="Center" />
					<TextBlock Grid.Row="2" Grid.Column="5" Margin="10,3,3,3" Text="{Binding WorstResultPeriod, FallbackValue=01/01/2000-31/12/2001}" HorizontalAlignment="Center" />
				</Grid>
			</GroupBox>
		</Grid>
	</Expander>	
</UserControl>
